Skip to content

Clarify required Windows Toast notification configuration - #3333

Merged
TheCodeTraveler merged 1 commit into
mainfrom
jfversluis-toast-com-exception
Oct 6, 2026
Merged

TheCodeTraveler merged 1 commit into
mainfrom
jfversluis-toast-com-exception

Conversation

@jfversluis

Copy link
Copy Markdown
Member

Description of Change

This was prompted by someone on the MAUIverse Discord encountering COMException 0x80070490: Element not found when showing a Toast on Windows with .NET 10 and CommunityToolkit.Maui 15.0.1. They weren't aware that SetShouldEnableSnackbarOnWindows(true) is also required for Toast.

The configuration is already documented, so this is a diagnostic/usability improvement rather than a fix for a .NET 10 regression. It makes the requirement discoverable from the exception without needing to read the docs first:

  • Throw an actionable InvalidOperationException before showing a Windows Toast when the notification option is disabled, including the initialization code, packaged-app manifest guidance, and a documentation HelpLink.
  • Preserve cancellation precedence.
  • Clarify in the API documentation that the existing Snackbar option enables both Toast and Snackbar.
  • Add regression coverage for enabled and disabled configuration.

If maintainers don't feel this additional guidance is useful, please feel free to close this PR.

Linked Issues

No linked issue; prompted by a MAUIverse Discord support conversation about missing application configuration.

PR Checklist

No sample change is needed: the existing sample already enables the notification option. XML API documentation is updated in this PR; there is no separate MicrosoftDocs PR.

Additional information

Reproduced the original exception in an unpackaged Windows app using .NET 10 and Toolkit NuGet 15.0.1. Registering the Windows notification manager made both first and subsequent Toast calls succeed.

Verified the modified implementation in a WinUI-hosted Windows reproduction: missing configuration produces the actionable setup exception, cancellation still produces OperationCanceledException, and configured notifications can be shown repeatedly and dismissed. The Windows Toolkit build succeeded and all 22 focused Toast tests passed.

Provide an actionable setup exception when Windows Toast notifications are not enabled and clarify that the Snackbar option also enables Toast.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 09:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused changes have no blocking findings; only an optional test-warning cleanup remains.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Improves Windows Toast diagnostics by explaining required notification configuration before attempting to show a notification.

Changes:

  • Adds an actionable setup exception while preserving cancellation precedence.
  • Clarifies that the Windows Snackbar option also enables Toast.
  • Adds tests for enabled and disabled configuration.
File Description
src/​CommunityToolkit.Maui/​Options.shared.cs Clarifies shared Toast and Snackbar setup.
src/​CommunityToolkit.Maui/​Alerts/​Toast/​Toast.windows.cs Checks cancellation and configuration before showing Toast.
src/​CommunityToolkit.Maui/​Alerts/​Toast/​Toast.shared.cs Adds configuration validation and setup documentation.
src/​CommunityToolkit.Maui.UnitTests/​Alerts/​ToastTests.cs Tests both configuration states.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@TheCodeTraveler
TheCodeTraveler merged commit e6c6d70 into main Oct 6, 2026
10 checks passed
@TheCodeTraveler
TheCodeTraveler deleted the jfversluis-toast-com-exception branch October 6, 2026 16:07
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants